<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@page import="java.util.Collection" %>
<%@page import="java.util.Iterator" %>
<%@page import="com.liuya.safe.model.SafePrivilege" %>
<%@ include file="../common/taglib.jsp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link rel="shortcut icon" href="${contextPath}/style/def/favicon.ico">
    <%@ include file="../common/static.jsp" %>
        <%
I18N i18n=I18N.getInstance();
SafePrivilege pvlg=(SafePrivilege)request.getAttribute( "privilege" );

String pvlgUrl="/nonRolePriviMng/openTree.do";
String pvlgText=i18n.say( "Non_role_privilege" );
if( pvlg.getType()==SafePrivilege.BUSINESS_PRIVILEGE ) {
	pvlgUrl="/privilegeMng/openTree.do";
	pvlgText=i18n.say( "Privilege" );
}

String[] mainMenuHrefs=new String[]{
		pvlgUrl
};
String[] mainMenuTexts=new String[] {
		pvlgText
};
request.setAttribute( "mainMenuHrefs", mainMenuHrefs );
request.setAttribute( "mainMenuTexts", mainMenuTexts );
%>

    <title><%=i18n.say("Choose_Privilege_Type")%>
    </title>
<body>
<jsp:include page="../common/header.jsp"></jsp:include>
<%@include file="../common/menu.jsp" %>

<%
    String id = (String) request.getAttribute("id");
%>

<div class="smallContainer">
    <form id="typeForm">
        <label><%=i18n.say("Choose_Privilege_Type")%>
        </label>
        <input type="radio" name="type" value="query"/><%=i18n.say("Query_Privilege")%>
        <input type="radio" name="type" value="decision"/><%=i18n.say("Decision_Privilege")%>
        <input type="submit" value="OK"/>
    </form>
</div>

<jsp:include page="../common/footer.jsp"></jsp:include>

<script type="text/javascript">
    jQuery(document).ready(function () {
        jQuery('#typeForm').submit(function () {
            var type = jQuery("#typeForm :input[name=type][checked]").val();

            if ("query" == type) {
                window.location = "/queryEntitlement/decision.do?id=<%=id%>";
            } else {
                window.location = "/decisionEntitlement/decision.do?id=<%=id%>";
            }

            return false;
        });
    });

</script>

</body>
</html>